home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / Timer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  2.8 KB  |  135 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Timer.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __TIMER__
  18. #define __TIMER__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __OSUTILS__
  27. #include <OSUtils.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30. /*    #include <Memory.h>                                            */
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. #if GENERATINGPOWERPC
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. #ifdef __CFM68K__
  41. #pragma lib_export on
  42. #endif
  43.  
  44.  
  45. enum {
  46. /* high bit of qType is set if task is active */
  47.     kTMTaskActive                = (1L << 15)
  48. };
  49.  
  50. typedef struct TMTask TMTask, *TMTaskPtr;
  51.  
  52. /*
  53.         TimerProcPtr uses register based parameters on the 68k and cannot
  54.         be written in or called from a high-level language without the help of
  55.         mixed mode or assembly glue.
  56.  
  57.         In:
  58.          => tmTaskPtr       A1.L
  59. */
  60.  
  61. #if GENERATINGCFM
  62. typedef UniversalProcPtr TimerUPP;
  63. #else
  64. typedef Register68kProcPtr TimerUPP;
  65. #endif
  66.  
  67. struct TMTask {
  68.     QElemPtr                        qLink;
  69.     short                            qType;
  70.     TimerUPP                        tmAddr;
  71.     long                            tmCount;
  72.     long                            tmWakeUp;
  73.     long                            tmReserved;
  74. };
  75.  
  76. #if !GENERATINGCFM
  77. #pragma parameter InsTime(__A0)
  78. #endif
  79. extern pascal void InsTime(QElemPtr tmTaskPtr)
  80.  ONEWORDINLINE(0xA058);
  81.  
  82. #if !GENERATINGCFM
  83. #pragma parameter InsXTime(__A0)
  84. #endif
  85. extern pascal void InsXTime(QElemPtr tmTaskPtr)
  86.  ONEWORDINLINE(0xA458);
  87.  
  88. #if !GENERATINGCFM
  89. #pragma parameter PrimeTime(__A0, __D0)
  90. #endif
  91. extern pascal void PrimeTime(QElemPtr tmTaskPtr, long count)
  92.  ONEWORDINLINE(0xA05A);
  93.  
  94. #if !GENERATINGCFM
  95. #pragma parameter RmvTime(__A0)
  96. #endif
  97. extern pascal void RmvTime(QElemPtr tmTaskPtr)
  98.  ONEWORDINLINE(0xA059);
  99. extern pascal void Microseconds(UnsignedWide *microTickCount)
  100.  FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
  101. enum {
  102.     uppTimerProcInfo = kRegisterBased
  103.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA1, SIZE_CODE(sizeof(TMTaskPtr)))
  104. };
  105.  
  106. #if GENERATINGCFM
  107. #define NewTimerProc(userRoutine)        \
  108.         (TimerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentArchitecture())
  109. #else
  110. #define NewTimerProc(userRoutine)        \
  111.         ((TimerUPP) (userRoutine))
  112. #endif
  113.  
  114. #if GENERATINGCFM
  115. #define CallTimerProc(userRoutine, tmTaskPtr)        \
  116.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppTimerProcInfo, (tmTaskPtr))
  117. #else
  118. /* (*TimerProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  119. #endif
  120.  
  121.  
  122. #ifdef __CFM68K__
  123. #pragma lib_export off
  124. #endif
  125.  
  126. #if GENERATINGPOWERPC
  127. #pragma options align=reset
  128. #endif
  129.  
  130. #ifdef __cplusplus
  131. }
  132. #endif
  133.  
  134. #endif /* __TIMER__ */
  135.